<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@page import="org.springframework.web.util.UrlPathHelper"%>    
<!DOCTYPE html PUBLIC>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="css/board.css" />
<title>Insert title here</title>
</head>
<body>
<%
UrlPathHelper urlPathHelper = new UrlPathHelper();
String endUrl = urlPathHelper.getOriginatingRequestUri(request);
session.setAttribute("url", endUrl);
%>
<div id='boardFrm' align="center">
	<!-- 상단 타이틀 이미지 -->
	<div align="left" style = "margin-bottom: 20px; margin-top: 20px">
		<img src = "images/board/recomen_tt.gif"/>
	</div>
		<div style="text-align: right; font-family: 맑은 고딕; 
	font-size: 12px; color:#BDBDBD; margin-bottom: 10px;">
	페이지 : ${page}&nbsp; of &nbsp;${lastPage}
	</div>
		<!-- 게시판 타이틀 -->
			<div class = 'board_title'>
			<span style="width: 5%;">NO</span>
			<span style="width: 60%;">제목</span>
			<span style="width: 10%;">조회수</span>
			<span style="width: 10%;">작성자</span>
			<span style="width: 10%;">작성일</span>
		</div>
		
		<!-- 게시글 -->
		<c:forEach items="${boards}" var="board">
		<div class = 'list_frm'>
			<span style="width: 5%;">${board.idx}</span>
			<span style="width: 60%;"><a href= "recom_detail.do?idx=${board.idx}">
			${board.title}</a>&nbsp;&nbsp;&nbsp;&nbsp;(${board.reply})</span>
			<span style="width: 10%;">${board.hit}</span>
			<span style="width: 10%;">${board.writer}</span>
			<span style="width: 10%;"><fmt:formatDate value="${board.wdate}" pattern="yyyy-MM-dd" /></span>
		</div>
		</c:forEach>
		
	</div>
	
	<!-- 페이징 -->
	<div id = 'paging' align = 'center'>
	<c:if test="${page > 1}"><a href="recommend.do?page=1">&lt;&lt;첫 페이지</a></c:if>&nbsp;
	<c:if test="${page > 2}"><a href="recommend.do?page=${page-1 }">&lt;이전 페이지</a></c:if>&nbsp;
	<c:if test="${page < lastPage-1}"><a href="recommend.do?page=${page+1 }">다음 페이지&gt;</a></c:if>&nbsp;
	<c:if test="${page < lastPage}"><a href="recommend.do?page=${lastPage }">마지막 페이지&gt;&gt;</a></c:if>&nbsp;	
	</div>
	
	<!-- 글쓰기 버튼 -->
	<div class = 'boardFrm' align="center" style = "margin-left: 900px; margin-bottom: 30px;">
	<input class = "findBtn" style  = "width: 100px"
	type="button" value="새 글 쓰기" onclick="location.href='recom_write.do?page=${page}&action=new'" />
	</div>
	
	<!-- 글 검색 -->
	<!-- <div id = 'notice_find' align="center">
	<fieldset style = "border: 1px solid #EAEAEA; 
	background: #F6F6F6; width: 300px; padding: 10px;">
	<label style = "margin-right: 5px; font-weight: bold;">제목</label>
	<input type='text' id = 'findStr' style = "	width: 160px; height: 25px;" /> 
	<input type='button' class = 'findBtn' value='검색'/>
	</fieldset>
	</div> -->
	
</body>
</html>